package com.sskj.mine.presenter;

import com.lzy.okrx2.adapter.FlowableBody;
import com.sskj.common.base.HttpData;
import com.sskj.lib.bean.PageBean;
import com.sskj.lib.http.JsonConverter;
import com.sskj.mine.bean.OtherAssetBean;
import com.sskj.mine.ui.fragment.OtherAssetFragment;


import java.util.ArrayList;
import java.util.List;

import io.reactivex.Flowable;


/**
 * @author Hey
 * Create at  2019/05/18
 */
public class OtherAssetPresenter extends BasePresenter<OtherAssetFragment> {

    public Flowable<List<OtherAssetBean>> getOtherAssetRecord(String p, String size) {
        return httpService.getOtherAssetRecord(p, size)
                .converter(new JsonConverter<HttpData<PageBean<OtherAssetBean>>>() {
                })
                .adapt(new FlowableBody<>())
                .map(pageBeanHttpData -> pageBeanHttpData.getData().getList())
                .onErrorReturnItem(new ArrayList<>());
    }
}
